import { _decorator, Node } from 'cc';
import { BattleCate, GameType } from '../core/Game';
import { EightBallGame } from './EightBallGame';
import { NineBallGame } from './NineBallGame';
import { SnookerBallGame } from './SnookerBallGame';
import { EndlessBallGame } from './EndlessBallGame';
import { FancyBallGame } from './FancyBallGame';

export class BallGameFactory {
  public static newBallGame(battle: BattleCate, bType: GameType, bNode: Node) {
    if (battle.isEndlessBattle()) {
      return new EndlessBallGame(bNode);
    } else if (battle.isFancyBattle()) {
      return new FancyBallGame(bNode);
    }
    if (bType.isEightBall()) {
      return new EightBallGame(bNode);
    }
    if (bType.isNineBall()) {
      return new NineBallGame(bNode);
    }
    if (bType.isSnooker()) {
      return new SnookerBallGame(bNode);
    }
    return new EightBallGame(bNode);
  }
  constructor() { 
  }
}